import RTS from '@/router/ruom.tsx'
import RITS from '@/router/ruim.tsx'
import { RoutePropsExtend, IMenus } from '@/router/route.ts'
import { groupBy } from 'es-toolkit'

function makeMenu(params: RoutePropsExtend): IMenus[] | undefined {
  const List = params?.children && params.children
  if (!List) {
    return
  }
  return (List as Array<any>)
    ?.filter((item) => item.meta)
    ?.map(
      (item, index): IMenus => ({
        key: index,
        label: item.meta.title,
        icon: item.meta.icon,
        path: item.path,
        group: item.meta.group
      })
    )
}
const [Menus] = RTS
export const RoumMenuList = makeMenu(Menus)

const [MenusI] = RITS
const TempList1 = makeMenu(MenusI) as Array<any>
export const RoimMenuGroup = groupBy(TempList1, (item) => item.group)

export const _PAGE_ = {
  def: '/ruom',
  err: '/404',
  ruim: {
    label: 'abcd',
    value: '/ruim'
  },
  ruom: {
    label: 'xyz',
    value: '/ruom'
  }
}

export const _ResultImages = {
  base: './results/',
  '404': '页面404.png',
  'PAGE NULL': '暂无地址.png',
  'LOSE RES': '暂无网络.png',
  Loading: '页面加载中.png',
  DEV: '系统开发中.png',
  RESTORE: '系统维护.png'
}
